#!/usr/bin/env python
# encoding: utf-8
'''
@author: Excelsiorly
@license: (C) Copyright 2021, All Rights Reserved.
@contact: excelsiorly@qq.com
@file: 0036.py
@time: 2021/11/21 16:49
@desc:
'''


class Solution(object):
    def countDigitOne(self, n):
        """
        :type n: int
        :rtype: int
        """
        count = 0
        for i in range(1, n+1):
            if '1' in str(i):
                count += 1

        return count

if __name__ == '__main__':
    res = Solution().countDigitOne(12)
    print(res)